<template>
	<view class="notic" v-if="showTap != false">
		<view class="title">
			<uni-tag :inverted="true" text="置顶" type="warning"/>
			<h3>{{noticInfo.title}}</h3>
		</view>
		<view class="titleTwo">
			<view class="authors">
				{{noticInfo.author}}
			</view>
			<view class="date">
				<uni-dateformat date="2020/10/20 20:20:20"></uni-dateformat>
			</view>
			<view class="view_count">
				<text>阅读量</text>
				<text>{{noticInfo.view_count}}</text>
			</view>
		</view>
		<view class="conent">
			<view class="text" v-html="noticInfo.content">
			</view>
		</view>
	</view>
</template>

<script setup>
import {ref} from "vue"
import {onLoad} from "@dcloudio/uni-app"
import {request} from "../../utils/request.js"
let noticInfo = ref({})
let id = ref("")
let publish_date = ref("")
let showTap = ref(false)
let type = ref("")
onLoad((e)=>{
	id.value = e.id
	type.value = e.type
	publish_date.value = e.publish_date
	getNoticInfo()
	if(type.value == "updata"){
		uni.setNavigationBarTitle({
			title:"订阅更新"
		})
	}else if(type.value == "proment"){
		uni.setNavigationBarTitle({
			title:"常见问题"
		})
	}else{
		
	}
})
//获取公告
const getNoticInfo = () =>{
	// request({
	// 	url:"/wallNewsDetail",
	// 	data:{
	// 		id:id.value
	// 	}
	// }).then((res)=>{
	// 	noticInfo.value = res.data.data
	// })
	uniCloud.callFunction({
		name:"getNoticInfo",
		data:{
			_id:id.value,
			publish_date:publish_date.value
		}
	}).then(res=>{
		noticInfo.value = res.result.data[0] || []
		showTap.value = true
	})
}
</script>

<style lang="scss">
.notic{
	padding: 30rpx 30rpx;
	.title{
		h3{
			display: contents;
		}
	}
	.titleTwo{
		color: #999;
		font-size: 30rpx;
		display: flex;
		justify-content: space-between;
		margin: 30rpx 0;
		.authors{
			margin-right: 20rpx;
		}
	}
	
}
</style>
